function [xMin fMin] = minEdges(x, f, threshold)
%MINEDGES cutting minimums of continious function f on interval x sizes of x and f MUST AGREE!
% INPUT:
%      x - arguments array;
%      f - array of values of function f(x) that corresponds to arguments
%      threshold - threshold of minimum areas
% OUTPUT:
%      xMin - row-vector of minimums arguments of multimodal function
%      fMin - row-vector of minimums values of multimodal function
%

% thresholding function in order to threshold
fThresholded = threshold * ones(1, length(f));
for i = 1:length(f)
    if (f(i) <= threshold)
        fThresholded(i) = f(i);
    end;
end;
% min = -max
[xMin fMin] = maxEdges(x, -fThresholded, -threshold);
fMin = -fMin;